package view.swing.popup;

import static util.Strings.STR_BLANK_PLACED;
import static util.Strings.STR_BLANK_VALUE;
import static util.Strings.STR_WHAT_BLANK_VALUE;

import javax.swing.JOptionPane;

import util.Coordinate;

import model.Letter;
public class JokerValue {

	public Coordinate coord;

	public JokerValue(Coordinate coord) {
		this.coord = coord;
	}

	public Letter askValue() {
		Letter[] choixPossibles = new Letter[Letter.values().length - 1];
		int i = 0;
		while (i < Letter.values().length - 1) {
			if (Letter.values()[i] != Letter.BLANK) {
				choixPossibles[i] = Letter.values()[i++];
			}
		}
		return (Letter) JOptionPane.showInputDialog(null,
				String.format(STR_BLANK_PLACED, coord)
						+ "\n"+STR_WHAT_BLANK_VALUE,
						STR_BLANK_VALUE, JOptionPane.QUESTION_MESSAGE, null,
				choixPossibles, null);
	}
}
